package array.double_pointer_AND_sort;
//盛水最多的容器
public class lc11 {
    public static void main(String[] args) {
        int[] height=new int[]{1,8,6,2,5,4,8,3,7};
        System.out.println(maxArea(height));

    }
    public static int maxArea(int[] height) {
        int temp;
        int max;
        temp=max=0;
        int n=0;
        int i=0;
        int j=height.length-1;
        while(i!=j){
            temp=Math.min(height[i],height[j])*(j-i);
            if(temp>max){
                max=temp;
            }
            if(height[i]<height[j]){
                ++i;
            }else{
                --j;
            }
        }
        return max;
    }


}
